const mongoose = require('mongoose');

const DB_URL = "mongodb://localhost:27017/sh2003";

mongoose.connect(DB_URL, { useNewUrlParser: true, useUnifiedTopology: true });

mongoose.connection.on('connected', (err) => {
    if(err) throw err;
    console.log('connected success');
});

mongoose.connection.on('diconnected', (err) => {
    if(err) throw err;
    console.log('disconnected success');
});

mongoose.connection.on('error', (err) => {
    if(err) throw err;
    console.log('error occur');
});

module.exports = mongoose;